<?php

error_reporting( E_ALL );
ini_set( 'display_errors', '1' );
//将出错信息输出到一个文本文件
ini_set( 'error_log', dirname( __DIR__ ) . '/logs/php_error_log.txt' );

//定义常量 APP_ROOT web root
define( 'APP_ROOT', dirname( __DIR__ ) . '/' );
define( 'APP_MODULE', dirname( __DIR__ ) . '/apps/' );

$di = new \Phalcon\DI\FactoryDefault();
//Registering config
$di->set( 'config', require APP_ROOT . 'config/config.php' );

$loader = new \Phalcon\Loader();
/**
 * We're a registering a set of directories taken from the configuration file
 */
$loader->registerNamespaces( array(
	'libraries' => APP_ROOT . 'libraries/',
	'enums'		=> APP_ROOT . 'enums/',
	'listeners'	=> APP_ROOT . 'listeners/',
    'vendors'   => APP_ROOT . 'vendors/',
// 	'ephalcon' => APP_ROOT . 'ephalcon/',	
));
$loader->register();

require APP_ROOT . 'config/services.php';//加载公共services
$app = new \Phalcon\Mvc\Application( $di );

// Register the installed modules
$app->registerModules( array(
        'fzq' => 
		array(
            'className' => 'apps\fzq\Module',
            'path' => APP_ROOT . 'apps/fzq/Module.php'
        ),
		
// 		'fzqs' =>
// 		array(
// 				'className' => 'apps\fzqs\Module',
// 				'path' => APP_ROOT . 'apps/fzqs/Module.php'
// 		)
));

try
{
// 	var_dump( get_class_methods( get_class( $app )));
	echo $app->handle()->getContent();
}
catch( \Exception $e )
{
	echo $e->getTraceAsString(), $e->getMessage();
}